<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<jsp:useBean id="usersPojo" class="com.wangsh.usersCenter.users.pojo.AUsers"/>
<c:set value="${requestScope.response.data.one }" var="users"/>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<title>修改个人信息 - 用户中心</title>
		<%@ include file="/common/include/title.jsp"%>
	    <link rel="stylesheet" href="${rootPath }/common/resource/bootstrapvalidator/css/form-validation.css" rel="stylesheet">
	  	<script type="text/javascript" src="${rootPath }/common/resource/bootstrapvalidator/js/form-validation.js"></script>
	  	
	  	<script language="javascript" type="text/javascript" src="${rootPath }/common/resource/My97DatePicker/WdatePicker.js"></script>
	  	<script type="text/javascript">
	  		$(function()
			{
			  	$("#form").FormValidation({
		  			fields:
	  				{
		  				/* qq */
		  				qq:
	  					{
		  					validators: {
		  	                    notEmpty: {
		  	                        message: 'qq不能为空'
		  	                    },
		  	                    stringLength: {
		  	                        min: 4,
		  	                        max:40,
		  	                        message: 'qq的长度为在4位与40位之间'
		  	                    },
		  	                    regexp: {
		  	                        regexp: /^[\d]+$/i,
		  	                        message: 'qq不符合规则'
		  	                    }
		  	                }
	  					},
	  					phone:
	  					{
		  					validators: {
		  	                    notEmpty: {
		  	                        message: '手机号不能为空'
		  	                    },
		  	                    stringLength: {
		  	                        min: 11,
		  	                        max:11,
		  	                        message: '手机号的长度为在11位'
		  	                    },
		  	                    regexp: {
		  	                        regexp: /^[\d]{11}$/i,
		  	                        message: '手机号不符合规则'
		  	                    }
		  	                }
	  					},
	  					weiXin:
	  					{
		  					validators: {
		  	                    notEmpty: {
		  	                        message: '微信不能为空'
		  	                    },
		  	                    stringLength: {
		  	                        min: 2,
		  	                        max:20,
		  	                        message: '微信的长度为在2--20位'
		  	                    }
		  	                }
	  					}
	  				}
				});
			  	
			  	/* 查询一级节点 */
				selectRegion('region1','region1','','true');
			});
	  	</script>
	</head>
	<body>
		<%@ include file="/common/include/header.jsp"%>
		<!-- 网页的主体 -->
		<div class="container">
			<div class="col-md-8 col-sm-10">
				<form id="form" method="post" class="form-horizontal" action="${rootPath }/head/users/usersUpdateSubmit.htm">
					<input type="hidden" name="operType" value="${param.operType }">
	
					<h2
						class="col-sm-10 col-sm-offset-1 form-signin-heading text-center">修改个人信息</h2>
					<div class="form-group">
						<label for="email" class="col-sm-3 control-label">邮箱</label>
						<div class="col-sm-8">
							${users.email }
							${users.emailStatusStr }
							<c:if test="${users.emailStatus == '0'}">
								<a href="${rootPath }/emailVerfySend.htm?email=${users.email }" class="btn btn-primary">重新激活</a>
							</c:if>
							<a href="${rootPath }/head/users/usersUpdate.htm?operType=updateEmail" class="btn btn-primary">修改邮箱</a>
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">昵称</label>
						<div class="col-sm-8">
							<input type="text" name="nickName" id="nickName" value="${users.nickName }"
								class="form-control" placeholder="昵称" />
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">真实姓名</label>
						<div class="col-sm-8">
							<input type="text" name="trueName" id="trueName" value="${users.trueName }"
								class="form-control" placeholder="真实姓名" />
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">qq</label>
						<div class="col-sm-8">
							<input type="text" name="qq" id="qq" value="${users.qq }"
								class="form-control" placeholder="qq" />
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">手机</label>
						<div class="col-sm-8">
							<input type="text" name="phone" id="phone" value="${users.phone }"
								class="form-control" placeholder="手机" />
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">微信</label>
						<div class="col-sm-8">
							<input type="text" name="weiXin" id="weiXin" value="${users.weiXin }"
								class="form-control" placeholder="微信" />
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">生日</label>
						<div class="col-sm-8">
							<c:choose>
								<c:when test="${users.birthday != null}">
									<c:set value="${users.birthday }" var="birthday"/>
								</c:when>
								<c:otherwise>
									<fmt:formatDate value="${sys_now }" pattern="yyyy-MM-dd HH:mm:ss" var="birthday"/>
								</c:otherwise>
							</c:choose>
							<input type="text" name="birthdayStr" id="birthdayStr" value="${birthday }" readonly="readonly"
								onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"
								class="form-control" placeholder="生日" />
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">性别</label>
						<div class="col-sm-8">
							<c:forEach items="${usersPojo.enumsMap }" var="me" varStatus="stat">
								<c:if test="${fn:startsWith(me.key,'SEX')}">
									<!-- 拆分,按照-拆分,取最后一个 -->
									<c:set value="${fn:split(me.key, '-')}" var="keys"/>
									<div class="form-check form-check-inline">
										<label class="form-check-label" for="${me.key}">
											<input type="radio" name="sex" id="${me.key}" value="${keys[1] }" 
												class="form-check-input" placeholder="生日" 
												${users.sex == keys[1] ? 'checked' : '' }
											/>
										    ${me.value }
										</label>
									</div>
								</c:if>
							</c:forEach>
						</div>
					</div>
					<div class="form-row">
						<div class="col-auto">
							<label for="inputPassword" class="col-sm-3 control-label">籍贯</label>
							<div class="col-auto">
								<c:choose>
									<c:when test="${fn:contains(users.region.treeName,'|-->')}">
										${fn:replace(users.region.treeName,'|-->','  ')}
									</c:when>
									<c:otherwise>
										${users.region.treeName}
									</c:otherwise>
								</c:choose>
								<input type="hidden" name="regionId" id="regionId" value="${users.regionId}">
								<span>
									<select id="region1" class="custom-select" onchange="return selectRegion('region1','region2','regionId','false');">
										<option value="0">请选择</option>
									</select>
									<select id="region2" class="custom-select" onchange="return selectRegion('region2','region3','regionId','false');">
									</select>
									<select id="region3" class="custom-select" onchange="return selectRegion('region3','region4','regionId','false');">
									</select>
									<select id="region4" class="custom-select" onchange="return selectRegion('region4','region5','regionId','false');">
									</select>
									<select id="region5" class="custom-select" onchange="return selectRegion('region5','region6','regionId','false');">
									</select>
									<select id="region6" class="custom-select" onchange="return selectRegion('region6','region7','regionId','false');">
									</select>
								</span>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">地址</label>
						<div class="col-sm-8">
							<textarea rows="5" cols="50" class="form-control" name="address" id="address">${users.address }</textarea>
						</div>
					</div>
					<%-- <div class="form-group">
						<label for="inputPassword" class="col-sm-3 control-label">用户类型</label>
						<div class="col-sm-8">
							<c:forEach items="${usersPojo.enumsMap }" var="me" varStatus="stat">
								<c:if test="${fn:startsWith(me.key,'USERS_TYPE')}">
									<div class="form-check form-check-inline">
										<!-- 拆分,按照-拆分,取最后一个 -->
										<c:set value="${fn:split(me.key, '-')}" var="keys"/>
										<input type="radio" name="sex" class="form-check-input" id="sex${keys[1] }" value="${keys[1] }"
											${users.sex == keys[1] ? 'checked' : '' }>
										<label class="form-check-label" for="sex${keys[1] }">${me.value }</label>
									</div>
								</c:if>
							</c:forEach>
						</div>
					</div> --%>
					<div class="form-row">
						<div class="col-auto">
							<label for="inputPassword" class="col-sm-10 control-label" title="最高学历">最高学历</label>
							<div class="col-auto">
								<span>
									<select id="education" name="education" class="custom-select">
										<c:forEach items="${usersPojo.enumsMap }" var="me" varStatus="stat">
											<c:if test="${fn:startsWith(me.key,'EDU')}">
												<!-- 拆分,按照-拆分,取最后一个 -->
												<c:set value="${fn:split(me.key, '-')}" var="keys"/>
												<option value="${keys[1] }" ${users.education == keys[1] ? 'selected' : '' }>${me.value }</option>
											</c:if>
										</c:forEach>
									</select>
								</span>
							</div>
						</div>
					</div>
					<div class="form-group">
						<div class="col-sm-8 col-sm-offset-2">
							<button class="btn btn-md btn-primary" type="submit">提交</button>
						</div>
					</div>
				</form>
			</div>
		</div>
		<%@ include file="/common/include/footer.jsp"%>
	</body>
</html>